home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / slider / slider.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-13  |  6.6 KB  |  216 lines

  1. VERSION 2.00
  2. Begin Form Slider 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Slider Demo"
  6.    ClientHeight    =   3720
  7.    ClientLeft      =   2580
  8.    ClientTop       =   2625
  9.    ClientWidth     =   4920
  10.    ControlBox      =   0   'False
  11.    Height          =   4125
  12.    Icon            =   SLIDER.FRX:0000
  13.    Left            =   2520
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   3720
  18.    ScaleWidth      =   4920
  19.    Top             =   2280
  20.    Width           =   5040
  21.    Begin HScrollBar HScroll1 
  22.       Height          =   285
  23.       LargeChange     =   60
  24.       Left            =   1860
  25.       Max             =   3210
  26.       Min             =   2010
  27.       SmallChange     =   60
  28.       TabIndex        =   4
  29.       Top             =   1710
  30.       Value           =   2010
  31.       Width           =   1515
  32.    End
  33.    Begin CommandButton Command1 
  34.       Caption         =   "E&xit"
  35.       Default         =   -1  'True
  36.       Height          =   405
  37.       Left            =   3780
  38.       TabIndex        =   5
  39.       Top             =   3180
  40.       Width           =   1005
  41.    End
  42.    Begin Timer Timer2 
  43.       Left            =   870
  44.       Top             =   4650
  45.    End
  46.    Begin PictureBox Picture2 
  47.       AutoSize        =   -1  'True
  48.       Height          =   675
  49.       Left            =   1470
  50.       Picture         =   SLIDER.FRX:0302
  51.       ScaleHeight     =   645
  52.       ScaleWidth      =   2340
  53.       TabIndex        =   1
  54.       Top             =   2130
  55.       Width           =   2370
  56.       Begin Image Image2 
  57.          Height          =   615
  58.          Left            =   30
  59.          Picture         =   SLIDER.FRX:2170
  60.          Top             =   0
  61.          Width           =   285
  62.       End
  63.    End
  64.    Begin Timer Timer1 
  65.       Left            =   330
  66.       Top             =   4620
  67.    End
  68.    Begin PictureBox Picture1 
  69.       AutoSize        =   -1  'True
  70.       Height          =   2370
  71.       Left            =   150
  72.       Picture         =   SLIDER.FRX:28DE
  73.       ScaleHeight     =   2340
  74.       ScaleWidth      =   645
  75.       TabIndex        =   0
  76.       Top             =   390
  77.       Width           =   675
  78.       Begin Image Image1 
  79.          Height          =   285
  80.          Left            =   30
  81.          Picture         =   SLIDER.FRX:4438
  82.          Top             =   30
  83.          Width           =   615
  84.       End
  85.    End
  86.    Begin Line Line1 
  87.       X1              =   2010
  88.       X2              =   2010
  89.       Y1              =   1110
  90.       Y2              =   1530
  91.    End
  92.    Begin Image Image3 
  93.       Height          =   765
  94.       Left            =   1860
  95.       Picture         =   SLIDER.FRX:4806
  96.       Top             =   930
  97.       Width           =   1515
  98.    End
  99.    Begin Label Label2 
  100.       BackColor       =   &H00C0C0C0&
  101.       BackStyle       =   0  'Transparent
  102.       Caption         =   "Slider Demo"
  103.       FontBold        =   -1  'True
  104.       FontItalic      =   0   'False
  105.       FontName        =   "Times New Roman"
  106.       FontSize        =   22.5
  107.       FontStrikethru  =   0   'False
  108.       FontUnderline   =   0   'False
  109.       ForeColor       =   &H00FF0000&
  110.       Height          =   525
  111.       Left            =   1530
  112.       TabIndex        =   3
  113.       Top             =   240
  114.       Width           =   2505
  115.    End
  116.    Begin Label Label1 
  117.       BackStyle       =   0  'Transparent
  118.       Caption         =   "Slider Demo"
  119.       FontBold        =   -1  'True
  120.       FontItalic      =   0   'False
  121.       FontName        =   "Times New Roman"
  122.       FontSize        =   22.5
  123.       FontStrikethru  =   0   'False
  124.       FontUnderline   =   0   'False
  125.       ForeColor       =   &H00808080&
  126.       Height          =   525
  127.       Left            =   1470
  128.       TabIndex        =   2
  129.       Top             =   210
  130.       Width           =   2505
  131.    End
  132. Dim Mouse_Button As Integer
  133. Dim Mouse_Y As Single
  134. Dim PicFrame As Integer
  135. Dim PicFrame1 As Integer
  136. Dim Mouse_X As Single
  137. Sub Command1_Click ()
  138.     Unload Me
  139. End Sub
  140. Sub Form_Load ()
  141.     '// Center Form
  142.     Top = Screen.Height / 2 - Height / 2
  143.     Left = Screen.Width / 2 - Width / 2
  144.     '// Set Vert. Slide Bar
  145.     Timer1.Enabled = False
  146.     Timer1.Interval = 10
  147.     PicFrame = 2 * Screen.TwipsPerPixelY
  148.     Image1.Top = 0
  149.     Image1.Left = 0
  150.     Picture1.Width = Image1.Width + PicFrame
  151.     '// Set Horz. Slide Bar
  152.     Timer2.Enabled = False
  153.     Timer2.Interval = 10
  154.     PicFrame1 = 2 * Screen.TwipsPerPixelY
  155.     Image2.Top = 0
  156.     Image2.Left = 0
  157.     Picture2.Height = Image2.Height + PicFrame1
  158. End Sub
  159. Sub HScroll1_Change ()
  160.     Line1.X1 = HScroll1.Value
  161.     Line1.X2 = HScroll1.Value
  162. End Sub
  163. Sub Image1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  164.     Timer1.Enabled = True
  165.     Mouse_Button = Button
  166.     Mouse_Y = Image1.Top + Y
  167. End Sub
  168. Sub Image1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  169.     Mouse_Button = Button
  170.     Mouse_Y = Image1.Top + Y
  171. End Sub
  172. Sub Image1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  173.     Timer1.Enabled = False
  174.     Mouse_Button = Button
  175.     Mouse_Y = Image1.Top + Y
  176. End Sub
  177. Sub Image2_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  178.     Timer2.Enabled = True
  179.     Mouse_Button = Button
  180.     Mouse_X = Image2.Left + X
  181. End Sub
  182. Sub Image2_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  183.     Mouse_Button = Button
  184.     Mouse_X = Image2.Left + X
  185. End Sub
  186. Sub Image2_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  187.     Timer2.Enabled = False
  188.     Mouse_Button = Button
  189.     Mouse_X = Image2.Left + X
  190. End Sub
  191. Sub Timer1_Timer ()
  192.     Dim TempTop As Integer
  193.     If Mouse_Button = 1 Then
  194.         
  195.         TempTop = Image1.Top
  196.         TempTop = Mouse_Y - TempWidth / 2
  197.         If TempTop + Image1.Height > Picture1.Height Then
  198.             TempTop = Picture1.Height - Image1.Height - PicFrame
  199.         End If
  200.         If TempTop < 0 Then TempTop = 0
  201.     End If
  202.     If Image1.Top <> TempTop Then Image1.Top = TempTop
  203. End Sub
  204. Sub Timer2_Timer ()
  205.     Dim TempLeft As Integer
  206.     If Mouse_Button = 1 Then
  207.         TempLeft = Image2.Left
  208.         TempLeft = Mouse_X - TempWidth / 2
  209.         If TempLeft + Image2.Width > Picture2.Width Then
  210.             TempLeft = Picture2.Width - Image2.Width - PicFrame
  211.         End If
  212.         If TempLeft < 0 Then TempLeft = 0
  213.     End If
  214.     If Image2.Left <> TempLeft Then Image2.Left = TempLeft
  215. End Sub
  216.